let user = {
    namespaced: true,
    state: {
        userInfo: {
            "a": 11
        },
        token: null
    },
    mutations: {
        // 保存登录用户信息
        setUser(state, userInfo){
            state.userInfo = userInfo;
        },
        // 清空登录用户信息
        clearUser(state){
            state.userInfo = {}
        },
        // 设置 token
        setToken(state, token){
            state.token = token
        },
        // 清除token
        clearToken(state){
            state.token = null;
        }
    },
    getters: {
        // 获取登录用户信息
        userInfo: state => {
            return state.userInfo;
        },
        token: state => {
            return state.token
        }
    },
    actions: {
    }
}

export default user;